import { defineStore } from "pinia";
import { ref ,computed} from 'vue'
// 定义store

 export const useCountStore =  defineStore('counter',() => {
    // 声明数据
    const count = ref()
   
    // // 保存用户会员信息
    const setCount = (val) => {
        // console.log(val);
        count.value = val
        uni.setStorageSync('nickname',  count.value);
    }
    // 清理会员信息
    const clearCount = () => {
        count.value = undefined
    }

    const nicknames = computed(() => {
        const value = uni.getStorageSync('nickname');
        return value
	
    })
    
    
    return {
        count,
        setCount,
        clearCount,
        nicknames
    }
})